﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.App.Api.Application.Command.Add;
using Traceability.App.Api.Application.Command.Get;
using Traceability.App.Domain;
using Traceability.App.ErrorCode;

namespace Traceability.App.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DeepController : ControllerBase
    {
        private readonly IMediator mediator;

        public DeepController(IMediator mediator) 
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 显示深加工信息
        /// </summary>
        /// <param name="request">参数</param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<DeepProcessing>> GetDeep([FromQuery]GetDeepProcessingCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 设置深加工信息（新增修改）
        /// 设置深加工信息添加修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> AddDeep(AddDeepCommand request)
        {
            return mediator.Send(request);
        }
    }
}
